package com.ktjiaoyu.service.impl;

import com.ktjiaoyu.entity.GoodsCategory;
import com.ktjiaoyu.mapper.CategoryMapper;
import com.ktjiaoyu.service.CategoryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("CategoryService")
public class CategoryServiceImpl implements CategoryService {
    private static final Logger LOGGER= LoggerFactory.getLogger(SysUserServiceImpl.class);

    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public List<GoodsCategory> getAll() {
        try {
            return categoryMapper.getAll();
        }catch (Exception e){
            LOGGER.error("执行CategoryServiceImpl.findAll()方法出现异常。",e);
            throw e;
        }
    }

    @Override
    public GoodsCategory findById(Long id) {
        try {
            return categoryMapper.findById(id);
        }catch (Exception e){
            LOGGER.error("执行CategoryServiceImpl.findById()方法出现异常。",e);
            throw e;
        }
    }
}
